package com.cloud.job.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.api.domain.job.VehicleMileage;
import com.cloud.api.domain.job.VehicleRunningData;
import com.cloud.job.mapper.VehicleRunningDataMapper;
import com.cloud.job.service.IVehicleRunningDataService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author 杨斌
 * 2024-03-4/3/2024
 */
@Service("vehicleRunningDataService")
@DS("doris")
public class VehicleRunningDataServiceImpl extends ServiceImpl<VehicleRunningDataMapper, VehicleRunningData> implements IVehicleRunningDataService {
    @Resource
    private VehicleRunningDataMapper vehicleRunningDataMapper;

    @Value("${mysql.name}")
    private String dataSource;
    @Override
    public List<VehicleMileage> getVehicleMileages() {
        return vehicleRunningDataMapper.getVehicleMileages(dataSource);
    }

    @Override
    public IPage<VehicleMileage> getVehicleMileages(Page<VehicleMileage> page) {
        return vehicleRunningDataMapper.getVehicleMileage(page, dataSource);
    }
}
